package com.chery.foxlogrecord.demo.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chery.foxlogrecord.demo.result.Result;
import com.chery.foxlogrecord.extension.operation.entity.Operation;
import com.chery.foxlogrecord.extension.operation.pojo.dto.OperationPageDto;
import com.chery.foxlogrecord.extension.operation.pojo.dto.OperationPageVO;
import com.chery.foxlogrecord.extension.operation.service.OperationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author qiangt
 * @version 1.0
 * @date 2024/3/29 15:34
 * @description: 操作记录控制器
 */
@RequiredArgsConstructor
@Api(tags = "操作记录")
@RestController
@RequestMapping("/v1/operation")
public class OperationController {

    private final OperationService operationService;

    @ApiOperation("分页查询")
    @PostMapping("/page")
    public Result<List<Operation>> pageByBusinessId(@RequestBody OperationPageDto pageDto) {
        return Result.success(operationService.pageByBusinessId(pageDto));
    }

    @ApiOperation("分页详情查询")
    @PostMapping("/pageDetail")
    public Page<OperationPageVO> pageDetailByBusinessId(@RequestBody OperationPageDto pageDto) {
        return operationService.pageDetailByBusinessId(pageDto);
    }
}
